import requestf from '@/common/requestFile.js'
import request from '@/common/request.js'

// 图片上传
export function imgUpload(formData) {
  return requestf({
    url: '/file/uploadFile',
	name:'file',
	path:formData
    // file: formData,
  })
}

// 文件上传
export function fileUpload(formData) {
  return requestf({
    url: ' /file/uploadFile',
	   name:'file',
	   file: formData,
  })
}

// 查询责任人
export function getPerson(projectId) {
  return request({
    url: `/quality/common/getProjectCompanyUsers/${projectId}/construct`,
	method:'get'
  })
}

// 项目列表
export function projectList(form) {
    return request({
      url: '/quality/check/list',
      method: 'get',
      data: form
    })
  }
// export function projectList(pageNum,pageSize,type,status,deadline,locationName,zrrName,fqrName) {
//     return request({
//       url: '/quality/check/list',
//       method: 'get',
//       data: {
// 		  pageNum,
// 		  pageSize,
// 		  type,
// 		  status,
// 		  deadline,
// 		  locationName,
// 		  zrrName,
// 		  fqrName,
// 	  }
//     })
//   }

// 新增巡检
export function addCheck(datas) {
    return request({
      url: '/quality/check/add',
      method: 'post',
      data: datas
    })
  }
  
// 新增巡检
export function updateCheck(datas) {
    return request({
      url: '/quality/check/update',
      method: 'post',
      data: datas
    })
  }
  
  // 查询巡检详情
export function findDetail(id) {
    return request({
      url: `/quality/check/info/${id}`,
      method: 'get',
    })
  }
  
  
  // 处理详情提交
      export function handleCheck(qualityId,pics,remark,files,action) {
        return request({
          url: `/quality/check/audit/${qualityId}`,
          method: 'post',
          data:{
            qualityId,
            pics,
            remark,
            files,
            action,
          }
        })
      }
	  
    // 删除巡检
export function deleteCheck(id) {
    return request({
      url: `/quality/check/delete?id=${id}`,
      method: 'post',
    })
  }
  
  // 巡检历史记录
  export function findHistory(id) {
      return request({
        url: `/quality/check/history/${id}`,
        method: 'get',
      })
    }